<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>发表作品</title>
</head>
<head>
		
		<meta charset="UTF-8">
		<title>添加信息</title>
			<script type="text/javascript" src="js/jquery-3.3.1.js" ></script>
		<link rel="stylesheet" href="bootstrap-3.3.7-dist/css/bootstrap.min.css" />		
		<script type="text/javascript" src="bootstrap-3.3.7-dist/js/bootstrap.min.js" ></script>
		 <script type="text/javascript" src="js/ajaxfileupload.js"></script> 
		<link rel="stylesheet" href="css/addreward.css" />
		 <script language="javascript" type="text/javascript" src="js/lib/My97DatePicker/WdatePicker.js"></script>   
		<script type="text/javascript">  
	$(function(){
		$("input") //将html控件实现jqury对象化  
		$("#btnupload").click(function(){ 
			$("#fileToUpload").click();
		});
	    //选择文件之后执行上传  
	    $("body").delegate('#fileToUpload','change',function(){
	        $.ajaxFileUpload({                                 
	            url:'fileuploadservlet.do?path=' + $("#stuid").val(), 
	            type: "post",   
	            secureuri:false,  
	            fileElementId:'fileToUpload',//file标签的id  
	            dataType: 'json',//返回数据的类型  
	           // data:{"prdid":""},//一同上传的数据  
	            success: function (data) {
	                //把图片替换 
					alert(data.result2);
	                $("#upload").attr("src", "/upload/"+data.result2);  //将图片路径传给<img 
	      			//将返回值中的文件相对路径及名称写入到文本框中 
	      			$("#prdphoto").val(data.result1); //将资源码传给 <input
						 alert(data.error_msg);     
	            },  
	            error: function (data, status, e) {  
	                alert(e);  
	            }  
	        });  
	    });  
	      
	});  
	</script>
	</head>
	
	<body>
		<form method="post" name="edituserform" action="addproduction.action" enctype="multipart/form-data">
		<table style="width: 30%;  text-align: center; font-family: '微软雅黑'; margin-left: auto;margin-right: auto; margin-top: 100px;">
			<tr>
                <th class="td1" ></th>
                <th class="td2" >添加作品信息</th> 
              </tr>
			<tr>
                <th class="td4" >姓名</th>
                <th class="td3" >${loginStu.stuname }</th> 
              </tr>
			<tr>
                <th class="td4" >作品名称</th>
                <th class="td3" >
                	<input  class="readyonly" type="text"  name="production.prdname" id="prdname"   value=""/>
                	
                </th>              
                
              </tr>
              <tr>
                <th class="td4" >发表时间</th>
                <th class="td3" ><input type="text" name="production.time" id="time" readOnly="true" value=""/>
             <img onClick="WdatePicker({el:$dp.$('time')})" 
            src="js/lib/My97DatePicker/skin/datePicker.gif" _fcksavedurl="js/lib/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">          
             </th> 
              </tr>            
              <tr>
                <th class="td1" >图片展示</th>
                <th class="td3" > 
                <img id="upload" src="" width="200px" height="200px"/>              
                <input class="readyonly" name="production.prdphoto" id="prdphoto" type="text" readOnly="true" value="" />
                <input id = "btnupload" class = "btnphoto" name="btnaddphoto" type="button" value="上传"/>
                <input id="fileToUpload" style="display:none" type="file" name="upfile"/>
                </th> 
              </tr>
              <tr>
                <th class="td1" ></th>
                <th class="td2" >
                	<input class="btn" name="submit" type="submit" value="提交" />
                	<input class="btn" name="reset" type="reset" value="重置" />
            		
                </th> 
              </tr>
		</table>
		</form>
	</body>
</html>